// Test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "XML\XMLTreeNode.h"
#include "Enemies\EnemyManager.h"


int _tmain(int argc, _TCHAR* argv[])
{
	CXMLTreeNode newFile;
	CEnemyManager * EM;
	CEnemyManager::EEnemyType l_type=CEnemyManager::BASIC;
	EM = new CEnemyManager();




	if (!newFile.LoadFile(".\\Data\\enemies.xml"))
	{
		printf("ERROR loading the file.");
		return 0;
	}

	CXMLTreeNode  m = newFile["enemies"];
	if (m.Exists())
	{
		int count = m.GetNumChildren();
		for (int i = 0; i < count; ++i)
		{
			std::string type = m(i).GetPszProperty("type");

			float pos_x = m(i).GetFloatProperty("pos_x");
			float pos_y = m(i).GetFloatProperty("pos_y");
			float pos_z = m(i).GetFloatProperty("pos_z");

			if (type == "patrol") l_type = CEnemyManager::PATROL;
			else if (type == "basic") l_type = CEnemyManager::BASIC;
			else if (type == "boss") l_type = CEnemyManager::BOSS;

			EM->AddEnemy(l_type,pos_x,pos_y,pos_z);




			

			//printf("Type: %s, X: %d, Y: %d, Z: %d\n", type, pos_x, pos_y, pos_z);
		}

		EM->Update();
		EM->Render();
	}

	delete EM;

	return 0;
}

